package com.jaws.demo.dao;

import com.jaws.demo.domain.AccountTrade;
import com.jaws.demo.domain.TradeSummary;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 账户交易DAO
 *
 * @author liangqm
 * @date 2018-05-03 10:20:15
 * @since v1.0.0
 */
public interface AccountTradeDao {

	/**
	 * 插入账户交易记录
	 *
	 * @param record ''
	 * @return
	 * @author liangqm
	 * @date 2018-05-03 10:21:18
	 * @since v1.0.0
	 */
	int insert(@Param("record") AccountTrade record);

	/**
	 * 批量插入
	 *
	 * @return
	 * @author liangqm
	 * @date 2018-05-03 11:22:18
	 * @params
	 * @since v1.0.0
	 */
	int batchInsert(@Param("records") List<AccountTrade> records);

	/**
	 * 查询账户交易记录
	 *
	 * @param id
	 * @return
	 * @author liangqm
	 * @date 2018-05-03 10:21:18
	 * @since v1.0.0
	 */
	AccountTrade selectByPrimaryKey(Integer id);

	/**
	 * 根据外部订单查询订单信息
	 *
	 * @param outTradeNo '外部订单号'
	 * @return AccountTrade
	 * @author maojian
	 * @date 2017-09-21 11:39:50
	 * @since v1.0.0
	 */
	AccountTrade queryOrderByOutTradeNo(@Param("outTradeNo") String outTradeNo);

	/**
	 * 根据唯一主键查询订单信息
	 *
	 * @param tradeNo    ''
	 * @param outTradeNo ''
	 * @return
	 * @author liangqm
	 * @date 2017-11-04 11:39:50
	 * @since v1.0.0
	 */
	AccountTrade queryAccountTradeByUniqueKey(@Param("tradeNo") String tradeNo, @Param("outTradeNo") String outTradeNo);

	/**
	 * 根据账户号和时间统计交易订单
	 *
	 * @param accountNo ''
	 * @param beginDate ''
	 * @param endDate   ''
	 * @return
	 * @author maojian
	 * @date 2017-09-21 11:39:53
	 * @since v1.0.0
	 */
	TradeSummary queryTradeSumByDate(@Param("accountNo") String accountNo, @Param("beginDate") String beginDate, @Param("endDate") String endDate);

	/**
	 * 根据账户号和时间批量统计交易订单
	 *
	 * @param userIdSet ''
	 * @param beginDate ''
	 * @param endDate   ''
	 * @return
	 * @author maojian
	 * @date 2017-09-21 11:39:53
	 * @since v1.0.0
	 */
	List<TradeSummary> batchQueryTradeSumByDate(@Param("segmentUserList") List<String> userIdSet, @Param("beginDate") String beginDate, @Param("endDate") String endDate);

	/**
	 * 根据账户号和截止时间统计交易订单
	 *
	 * @param accountNo ''
	 * @param endDate   ''
	 * @return
	 * @author maojian
	 * @date 2017-09-21 11:39:56
	 * @since v1.0.0
	 */
	long queryTradeSumUntilDate(@Param("accountNo") String accountNo, @Param("endDate") String endDate);

}